/*
 * Powered By XY
 * Since 2020
 */

package com.xy.biz.base.manager.impl;

import java.util.Collection;
import java.util.List;

import com.xy.biz.base.dao.ExpressDao;
import com.xy.biz.base.domain.bo.ExpressBO;
import com.xy.biz.base.domain.converter.ExpressConverter;
import com.xy.biz.base.domain.query.ExpressQuery;
import com.xy.biz.base.manager.ExpressManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 *
 *
 * @author zgy
 * @date 2021-9-17
 */
@Service
public class ExpressManagerImpl implements ExpressManager {

    @Autowired
    private ExpressDao expressDao;

    @Override
    public int saveExpress(ExpressBO expressBO) {
        return expressDao.saveExpress(ExpressConverter.toPO(expressBO));
    }

    /**
     * 根据快递名字获取快递配置信息
     *
     * @param expressName
     */
    @Override
    public ExpressBO getByExpress(String expressName) {
        return ExpressConverter.fromPO(expressDao.getByExpress(expressName));
    }

    @Override
    public int saveAllExpress(Collection<ExpressBO> collection) {
        return expressDao.saveAllExpress(ExpressConverter.toPO(collection));
    }

    @Override
    public int updateExpress(ExpressBO expressBO) {
        return expressDao.updateExpress(ExpressConverter.toPO(expressBO));
    }

    @Override
    public int deleteExpress(Long expressId) {
        return expressDao.deleteExpress(expressId);
    }

    @Override
    public ExpressBO getExpress(Long expressId) {
        return ExpressConverter.fromPO(expressDao.getExpress(expressId));
    }

    @Override
    public List<ExpressBO> listExpressById(Collection<Long> collection) {
        return ExpressConverter.fromPO(expressDao.listExpressById(collection));
    }

    @Override
    public List<ExpressBO> listExpress(ExpressQuery query) {
        return ExpressConverter.fromPO(expressDao.listExpress(query));
    }

    @Override
    public int countExpress(ExpressQuery query) {
        return expressDao.countExpress(query);
    }

}
